{


    let name = '张三丰'
    let age = 22
    let isstu = true
    let money = 1000
    let birth = new Date()
    let teachers = ['张老师', '李老师', '赵老师']

    let fn = e => e > 9 ? e : '0' + e
    let ft = d => {
        let dd = [d.getFullYear(), fn(d.getMonth() + 1), fn(d.getDate())].join('-')
        let tt = [fn(d.getHours()), fn(d.getMinutes()), fn(d.getSeconds())].join(':')
        return `${dd} ${tt}`
    }

//console.log(ft(new Date()))

    let json1 = {name, age, "birth": ft(birth), money, isstu, teachers}
    let jstr = JSON.stringify(json1)
    console.log(jstr)


    let obj = JSON.parse(jstr)
    console.log(obj.name)
    console.log(obj.teachers)
    console.log(obj.age)
    console.log(obj.money)
    console.log(obj.isstu)
    console.log(typeof (obj.birth)) //string

//string2Date
    console.log(new Date(obj.birth).toLocaleString())
    console.log(obj.birth)
    console.log(ft(new Date(obj.birth)))

}


